﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LxCFD
{
    public partial class ContactCFDFields
    {
        FvContact Contact;
        public void SetParameter(FvContact contact)
        {
            this.Contact = contact;
            if (!contact.IsEnabled)
                return;
            SetParameter_T();
        }
    }
    public partial class ContactCFDFields
    {
        ConnectBase T;

        public void SetParameter_T()
        {
            int flag = 0;
            flag += Convert.ToInt32(Contact.OZone.PhysicalModel.IsEnergyEnabled);
            flag += Convert.ToInt32(Contact.NZone.PhysicalModel.IsEnergyEnabled);
            if (flag == 0)
            {
                T = null;
            }
            else if (flag == 1)
            {
                throw new Exception("边界一侧未启用能量方程");
            }
            else
            {
                if (Contact.Thickness.IsEqual0())
                {
                    LxTool.CheckCreateInstance<ConnectWallOneSide, ConnectBase>(ref T);
                    var Ttemp = T as ConnectWallOneSide;
                    Ttemp.CheckCreate(Contact);
                    Ttemp.setConnect(Contact.EnergySource, Contact.OZone.CFDFields.T, Contact.NZone.CFDFields.T);
                    AppRes.SolveCenter.TemperatureGroup.Connects.Add(Ttemp);
                }
                else
                {
                    LxTool.CheckCreateInstance<ConnectWallTwoSide, ConnectBase>(ref T);
                    var Ttemp = T as ConnectWallTwoSide;
                    Ttemp.CheckCreate(Contact);
                    Ttemp.setConnect(Contact.ThermalConductivity, Contact.Thickness, Contact.EnergySource, Contact.OZone.CFDFields.T, Contact.NZone.CFDFields.T);
                    AppRes.SolveCenter.TemperatureGroup.Connects.Add(Ttemp);
                }
            }

        }
    }
}

